package com.example.carrierapp.ui.main.dispatch.detail;

import android.support.v4.view.ViewPager;

import com.example.carrierapp.base.BaseActivity;
import com.example.carrierapp.config.ConstValue;
import com.example.carrierapp.ui.adapter.DispatchSomeAdapter;
import com.example.carrierapp.ui.view.PagerSlidingTabStrips;
import com.example.carrierapp.util.LogUtil;
import com.example.lb.fingerdemo.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 调度详情
 */
public class DispatchSomeActivity extends BaseActivity {
    @BindView(R.id.pst_dispatch_tab)
    PagerSlidingTabStrips mPagerTab;
    @BindView(R.id.vp_dispatch_container)
    ViewPager mViewPager;
    private int mId;
    private boolean mShowOpera;

    @Override
    public int getContentView() {
        return R.layout.activity_dispatch_detail;
    }

    @Override
    public String getTitleString() {
        return null;
    }

    @Override
    public void initView() {
        super.initView();
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        mId = getIntent().getIntExtra(ConstValue.ID, 0);
        mShowOpera = getIntent().getBooleanExtra(ConstValue.SHOW_OPERA, false);
        LogUtil.d("DispatchSomeActivity-" + mId + "-" + mShowOpera);
    }

    @Override
    public void initEvent() {
        super.initEvent();
        DispatchSomeAdapter mAdapter = new DispatchSomeAdapter(getSupportFragmentManager(), getResources().getStringArray(R.array.title_dispatch), mId, mShowOpera);
        mViewPager.setAdapter(mAdapter);
        mViewPager.setCurrentItem(0);
        mPagerTab.setViewPager(mViewPager);
    }

    @OnClick({R.id.ib_dispatch_back})
    public void onBackClick() {
        finish();
    }
}
